<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/WEB-INF/template/template.xhtml">
	<ui:define name="content">
		<br />
		<div class="middle">
			<h2><h:outputText value="#{msg.AD_editPrinterIp_header1}"/></h2>
			<h:messages id="errMes" class="myError" showSummary="true" showDetail="false"></h:messages>
			<h:outputText id="msgSuccess" value="#{printerIpBean.message}"></h:outputText>
		</div>

		<h:form>
			<br />
			<h:dataTable class="table2" value="#{printerIpBean.listPrinters}"
				var="printer">
				<h:column>
					<f:facet name="header"><h:outputText value="#{msg.AD_editUnitMeasures_name}"/></f:facet>
					<h:outputText value="#{printer.name}"></h:outputText>
				</h:column>
				<h:column>
					<f:facet name="header"><h:outputText value="#{msg.AD_editPrinterIp_Ip}"/></f:facet>
					<h:panelGrid styleClass="panelGrid" style="border:none;" id="ipGrid" >
						<h:outputText rendered="#{printerIpBean.action == 'view'}"
							value="#{printer.ip}"></h:outputText>
						<h:inputText id="inIp"
							rendered="#{printerIpBean.action == 'edit'}"
							value="#{printer.ip}">
							<f:validator validatorId="validators.IpValidator" />
						</h:inputText>
					</h:panelGrid>
				</h:column>
				<h:column>
					<f:facet name="header"><h:outputText value="#{msg.AD_editPrinterIp_Action}"/></f:facet>
					<h:panelGrid class="panelGridClean" id="btnGrid">
						<h:commandButton id="editBt" class="editBtn"
							rendered="#{printerIpBean.action == 'view'}" value="#{msg.AD_domainCrud_edit}"
							actionListener="#{printerIpBean.editCommand}">
							<f:ajax render=":errMes :msgSuccess ipGrid btnGrid"></f:ajax>
						</h:commandButton>
						<h:commandButton id="saveBt" class="button"
							rendered="#{printerIpBean.action == 'edit'}" value="#{msg.OM_resourcecrud_save}"
							actionListener="#{printerIpBean.saveCommand}">
							<f:ajax render=":errMes :msgSuccess ipGrid btnGrid" execute="inIp"></f:ajax>
							<f:attribute name="printerId" value="#{printer.id}"></f:attribute>
							<f:attribute name="printerIp" value="#{printer.ip}"></f:attribute>
						</h:commandButton>
						<h:commandButton id="cancelBt" class="button"
							rendered="#{printerIpBean.action == 'edit'}" value="#{msg.OM_resourcecrud_cancel}"
							actionListener="#{printerIpBean.cancelCommand}">
							<f:ajax render=":errMes :msgSuccess ipGrid btnGrid"></f:ajax>
						</h:commandButton>
					</h:panelGrid>
				</h:column>
			</h:dataTable>
		</h:form>
	</ui:define>
</ui:composition>
</html>